package net.gogogo.controller;

import net.gogogo.bean.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


/*
* RestController 组合注解
* */

@RestController
public class UserController {

    @RequestMapping("/user")
    public User sayHello(){
        User user = new User(1,"钱多多",18);
        return user;
    }

    @RequestMapping("/users")
    public List<User> sayHello1(){
        User user = new User(1,"钱多多",18);
        User user1 = new User(2,"钱太多",19);
        User user2 = new User(3,"钱百万",20);
        User user3 = new User(4,"穷光蛋",21);
        List<User> userList = new ArrayList<>();
        userList.add(user);
        userList.add(user1);
        userList.add(user2);
        userList.add(user3);
        return userList;
    }

}
